package com.ht.web.emp;

import com.ht.bean.emp.Dep;
import com.ht.bean.emp.Empinfo;
import com.ht.bean.emp.Post;
import com.ht.service.emp.DepService;
import com.ht.service.emp.PostService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author lrq
 * @date 2020/6/10 19:38
 * 中心跳转
 */
@Controller
@RequestMapping("skip")
public class CenterController {

    @Resource
    private DepService depService;
    @Resource
    private PostService postService;

    //去登录页面
    @RequestMapping("tologin")
    public String tologin(){
        return "managerui/login";
    }

    //去登录页面
    @RequestMapping("index")
    public String index(HttpSession session){
        Empinfo empinfo=(Empinfo) session.getAttribute("user");
        if(empinfo==null||empinfo.equals(null)){
            return "managerui/login";
        }
        return "redirect:managerui/index";
    }

    //去员工页面
    @RequestMapping("emplist")
    public String emplist(Model model){
        //获取所有部门和职位模糊查询
        List<Dep> depList = depService.list();
        List<Post> postList = postService.list();
        model.addAttribute("deps",depList);
        model.addAttribute("posts",postList);
        return "emp/emplist";
    }

    //去部门列表页面
    @RequestMapping("deplist")
    public String deplist(){
        return "emp/deplist";
    }

    //去到周报管理页面
    @RequestMapping("worklist")
    public String worklist(){
        return "emp/workdiarylist";
    }

    //去到职位管理页面
    @RequestMapping("postlist")
    public String postlist(){
        return "emp/postlist";
    }
    //去到职位添加页面
    @RequestMapping("postadd")
    public String postadd(){
        return "emp/postadd";
    }

    //去到我的周报管理页面
    @RequestMapping("myworklist")
    public String myworklist(){
        return "emp/myworkdiary";
    }

    //去到谈心记录页面
    @RequestMapping("chatlist")
    public String chatlist(){
        return "emp/chatrecordlist";
    }

    //去到首页页面
    @RequestMapping("headerList")
    public String headerList(){
        return "managerui/headerList";
    }

    //去到系统设置
    @RequestMapping("systemsetting")
    public String systemsetting(){
        return "managerui/systemsetting";
    }

    @RequestMapping("test")
    public String test(){
        return "systemsetting/test";
    }

    @RequestMapping("checklist")
    public String checklist(){
        return "emp/checkworkdiary";
    }

    //去到权限管理
    @RequestMapping("jurisdiction")
    public String jurisdiction(){
        return "systemsetting/jurisdiction";
    }

}
